__all__=["Sphere"]

from OpenGL.GL import *
from OpenGL.GLU import *
from graphicobject import *
from bbox import *

class Sphere(GraphicObject):
    "A Sphere of a given radius."

    def __init__(self,radius=1, material=None, transformation=None):
        """Constructor.
        @param radius: sphere radius.
        @param material: the material object (Material). If None, means that
          no material is attached to this object and thus it will be rendered
          with the current material.
        @param transformation: a transformation (16-float vector). If None, 
          then an identity transformation is meant.
        """
        GraphicObject.__init__(self,BoundingBox((0,0,0),(radius*2,)*3), 
                               material,transformation)
        self.quadric = gluNewQuadric()
        self.radius = radius

    def draw(self):
        "Drawing code"
        GraphicObject.draw(self)
        print "desenha esfera "
        gluQuadricNormals(self.quadric, GLU_SMOOTH)
        gluSphere (self.quadric, self.radius, 32, 32)

if __name__=="__main__":
    # A simple test
    sphere = Sphere()
